package com.ihr360.payroll.model.dto.salary.task.period;

import com.ihr360.hibernate.type.encrypt.JsonEncryptType;
import com.ihr360.payroll.model.dto.salary.task.period.embeddable.StaffSalaryCalcContext;
import com.ihr360.payroll.model.dto.salary.task.period.embeddable.StaffSalaryTermId;
import com.ihr360.payroll.type.StaffRefStatus;
import com.ihr360.shared.entitywithlistener.TimeEntity;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

/**
 * 账期批次计算的上下文数据
 */
@Entity
@TypeDefs({
        @TypeDef(name = "json-encrypt", typeClass = JsonEncryptType.class)
})
@DynamicUpdate
public class StaffPayPeriodTermCalcContext  extends TimeEntity {

    @EmbeddedId
    StaffSalaryTermId id;

    @Column(length = 32)
    private String staffName;

    @Column(length = 20)
    private String mobileNo;

    @Column(length = 30)
    private String departmentName;

    private Long departmentId;

    @Column(length = 40, nullable = false, name = "companyId")
    private String companyId;

    private boolean isSinglePhase;

    @Column(columnDefinition = "text")
    @Type(type = "json-encrypt")
    private StaffSalaryCalcContext context;


    @Enumerated(EnumType.STRING)
    @Column(length = 10)
    private StaffRefStatus sihfStatus;
    @Column(length = 10)
    @Enumerated(EnumType.STRING)
    private StaffRefStatus attendanceStatus;

    public StaffSalaryTermId getId() {
        return id;
    }

    public void setId(StaffSalaryTermId id) {
        this.id = id;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public StaffSalaryCalcContext getContext() {
        return context;
    }

    public void setContext(StaffSalaryCalcContext context) {
        this.context = context;
    }

    public boolean isSinglePhase() {
        return isSinglePhase;
    }

    public void setIsSinglePhase(boolean isSinglePhase) {
        this.isSinglePhase = isSinglePhase;
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }

    public StaffRefStatus getSihfStatus() {
        return sihfStatus;
    }

    public void setSihfStatus(StaffRefStatus sihfStatus) {
        this.sihfStatus = sihfStatus;
    }

    public StaffRefStatus getAttendanceStatus() {
        return attendanceStatus;
    }

    public void setAttendanceStatus(StaffRefStatus attendanceStatus) {
        this.attendanceStatus = attendanceStatus;
    }

    public String getMobileNo() {
        return mobileNo;
    }

    public void setMobileNo(String mobileNo) {
        this.mobileNo = mobileNo;
    }

    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    public Long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }
}